﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microhard.Protal.Interfaces;
using Microhard.Core;

namespace Microhard.WebUI.Controllers
{
    public class HomeController : Controller
    {
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }


        public ActionResult PrdCategory(Guid? categoryID)
        {
            ICategory ic = IoC.Resolve<ICategory>();
            var model = ic.GetModelByID(categoryID.Value);
            return View(model);
        }

        /// <summary>
        /// 产品
        /// </summary>
        /// <param name="prdID"></param>
        /// <returns></returns>
        public ActionResult Product(Guid prdID)
        {
            IProduct prd = IoC.Resolve<IProduct>();
            var prdModel = prd.GetModelByID(prdID);
            return View(prdModel);
        }

        /// <summary>
        /// 文章
        /// </summary>
        /// <param name="articleID"></param>
        /// <returns></returns>
        public ActionResult Article(Guid articleID)
        {
            IArticle prd = IoC.Resolve<IArticle>();
            var prdModel = prd.GetModelByID(articleID);
            return View(prdModel);
        }

        /// <summary>
        /// 信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Info(string key)
        {
            ISiteInfo isi = IoC.Resolve<ISiteInfo>();
            var model = isi.GetModelByModel(new Microhard.Protal.Models.SiteInfoModel
            {
                Key = key
            });
            return View(model);
        }

        public ActionResult AddService()
        {
            return View();
        }

        public ActionResult SaveService()
        {
            return View();
        }
    }
}
